
import java.util.ArrayList;
import java.util.List;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Joris.Lefever
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Stapel stapel = new Stapel();
        List<Thread> threads = new ArrayList<>();
        for (int i = 0; i != 2; i++) {
            threads.add(new Thread(new Kok(stapel)));
        }
        for (int i = 0; i != 4; i++) {
            threads.add(new Thread(new Klant(stapel)));
        }
        for (Thread thread : threads) {
            thread.start();
        }
        try {
            for (Thread thread : threads) {
                thread.join();
            }
        } catch (InterruptedException ex) {
            System.err.println(ex);
        }
        System.out.println("Het aantal pannenkoeken op het einde is " + stapel.getAantalPannenkoeken());
      }

}

